home *** CD-ROM | disk | FTP | other *** search
- Path: news.bridge.net!news
- From: David Byrden <100101.2547@compuserve.com>
- Newsgroups: comp.lang.c++
- Subject: Re: deque container - how to implement?
- Date: 9 Jan 1996 06:01:39 GMT
- Organization: self-employed
- Message-ID: <4ct0c3$9gg@news.bridge.net>
- References: <4ce651$92t@galaxy.uci.agh.edu.pl>
- NNTP-Posting-Host: ppp-mia1-58.bridge.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
-
-
- Jurek;
-
- I have hardly studied deque and have never seen an implementation, but I
- will bet that it works like this; it consists of a contigous block of
- elements in the MIDDLE of a larger block of free space. Adding elements
- is fast because there is free space at each end. When it expands to bump
- either end of its free space, it allocates a larger block of memory from
- the heap and copies all its contents into the MIDDLE of the new block.
- Altering things in the middle is slow because the elements must remian
- contiguous, so up to half of the data will need to move.
-
- David
-
-
-